/* 
Copyright DAUPHIN Maxime 2005

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
http://www.gnu.org/licenses/gpl.txt
*/
#ifndef __BITMAP_H__
#define __BITMAP_H__

namespace Gui {

class Bitmap : public Object
{
	HBITMAP		m_hBitmap;
	BITMAP		m_bitmap;
	BITMAPINFO	m_bitmapInfo;
	bool		m_bCreated;
	void		*m_ppvBits;
	UINT		m_iColorDataType;
public:
	Bitmap(void);
	~Bitmap(void);
	Bitmap(const Bitmap& bmp);
	void create(HBITMAP hBitmap);
	void draw(Dc &dc, const Rect &rect);
	Rect getRect(void);
	int bytesPerLine(int nWidth, int nBitsPerPixel)
	{
		return ( (nWidth * nBitsPerPixel + 31) & (~31) ) / 8;
	}
	LPVOID getDibBits(void) const { return m_ppvBits; }
	HBITMAP getSafeHandle(void);
};

}; //namespace Gui {

#endif //#define __BITMAP_H__
